package com.example.chcrm.entity.common;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @Author 邹
 * @Date 2025/3/4 10:11
 * @Version 1.0
 */
    public class ResponseMsg<T> implements Serializable {

        private static final long serialVersionUID = 7302468380401978723L;

        public static final Integer STATUS_SUCCES = 0;

        public static final Integer STATUS_FAIL = -1;

        public static final Integer TOKEN_INVALID = -9;

        private Integer status;

        private String  message;

        private T data;

        private Integer total = 0;

        private String msg;


        /**
         * 校验无效的消息
         */
        private Map<String, List<String>> invalids;

        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }


        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }


        public T getData() {
            return data;
        }

        public void setData(T data) {
            this.data = data;
        }

        public void success(String msg){
            this.message = msg;
            this.status = STATUS_SUCCES;
        }

        public void fail(String msg){
            this.message = msg;
            this.status = STATUS_FAIL;
        }


        public Integer getTotal() {
            return total;
        }

        public void setTotal(Integer total) {
            this.total = total;
        }

        public Map<String, List<String>> getInvalids() {
            return invalids;
        }

        public void setInvalids(Map<String, List<String>> invalids) {
            this.invalids = invalids;
        }

        @Override
        public String toString() {
            return "ResponseMsg [status=" + status + ", message=" + message + ", data=" + data + ", total=" + total + "]";
        }

    }


